#include "../pch.h"

namespace BFX
{

REFXMLProcessingInstruction::REFXMLProcessingInstruction(const UniString& strTarget, const UniString& strData, REFXMLDocument* pDoc)
	: REFXMLLinkedNode(pDoc)
{
	m_strTarget = strTarget;
	m_strData = strData;
}

REFXMLProcessingInstruction::~REFXMLProcessingInstruction()
{
}

// Gets the name of the node.
UniString REFXMLProcessingInstruction::GetName() const
{
	return m_strTarget;
}

// Gets the name of the current node without the namespace prefix.
UniString REFXMLProcessingInstruction::GetLocalName() const
{
	return GetName();
}

// Gets or sets the value of the node.
UniString REFXMLProcessingInstruction::GetValue() const
{
	return m_strData;
}
void REFXMLProcessingInstruction::SetValue(const UniString& str)
{
	m_strData = str;
}

// Gets the target of the processing instruction.
UniString REFXMLProcessingInstruction::GetTarget() const
{
	return m_strTarget;
}

// Gets or sets the concatenated values of the node and all its children.
UniString REFXMLProcessingInstruction::GetInnerText() const
{
	return m_strData;
}
void REFXMLProcessingInstruction::SetInnerText(const UniString& str)
{
	m_strData = str;
}

// Gets the type of the current node.
XMLNodeType REFXMLProcessingInstruction::GetNodeType() const
{
	return XMLNodeType_ProcessingInstruction;
}

// Saves the node to the specified XmlWriter.
void REFXMLProcessingInstruction::WriteTo(REFXMLWriter* w) const
{
	w->WriteProcessingInstruction(m_strTarget, m_strData);
}
// Saves all the children of the node to the specified XmlWriter.
void REFXMLProcessingInstruction::WriteContentTo(REFXMLWriter* w) const
{
	// NOTE: intentionally do nothing
}

}	//	namespace BFX
